{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "         paths:{\n",
       "           'echarts': '/nbextensions/echarts/echarts.min', 'cang1_zhou1': '/nbextensions/echarts/he2_nan2_cang1_zhou1'\n",
       "         }\n",
       "    });\n",
       "</script>\n",
       "<div id=\"b2a973ee019c4512955ce0108c898a25\" style=\"width:1200px; height:600px;\"></div>\n",
       "\n",
       "<script>\n",
       "    require([ 'echarts', 'cang1_zhou1' ],function(ec){\n",
       "\tvar myChart = ec.init(document.getElementById('b2a973ee019c4512955ce0108c898a25'));\n",
       "var option =  {\n",
       "    \"series_id\": 6508273, \n",
       "    \"backgroundColor\": \"#fff\", \n",
       "    \"title\": [\n",
       "        {\n",
       "            \"textStyle\": {\n",
       "                \"color\": \"#000\", \n",
       "                \"fontSize\": 18\n",
       "            }, \n",
       "            \"subtext\": \"\", \n",
       "            \"text\": \"\\u6ca7\\u5dde\\u5e02\\u56fe\\u4f8b\\uff0d\\u5404\\u533a\\u9762\\u79ef\", \n",
       "            \"top\": \"auto\", \n",
       "            \"subtextStyle\": {\n",
       "                \"color\": \"#aaa\", \n",
       "                \"fontSize\": 12\n",
       "            }, \n",
       "            \"left\": \"auto\"\n",
       "        }\n",
       "    ], \n",
       "    \"color\": [\n",
       "        \"#c23531\", \n",
       "        \"#2f4554\", \n",
       "        \"#61a0a8\", \n",
       "        \"#d48265\", \n",
       "        \"#749f83\", \n",
       "        \"#ca8622\", \n",
       "        \"#bda29a\", \n",
       "        \"#6e7074\", \n",
       "        \"#546570\", \n",
       "        \"#c4ccd3\", \n",
       "        \"#f05b72\", \n",
       "        \"#ef5b9c\", \n",
       "        \"#f47920\", \n",
       "        \"#905a3d\", \n",
       "        \"#fab27b\", \n",
       "        \"#2a5caa\", \n",
       "        \"#444693\", \n",
       "        \"#726930\", \n",
       "        \"#b2d235\", \n",
       "        \"#6d8346\", \n",
       "        \"#ac6767\", \n",
       "        \"#1d953f\", \n",
       "        \"#6950a1\", \n",
       "        \"#918597\", \n",
       "        \"#f6f5ec\"\n",
       "    ], \n",
       "    \"series\": [\n",
       "        {\n",
       "            \"mapType\": \"\\u6ca7\\u5dde\", \n",
       "            \"showLegendSymbol\": false, \n",
       "            \"name\": \"\", \n",
       "            \"roam\": true, \n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u8fd0\\u6cb3\\u533a\", \n",
       "                    \"value\": 109.92\n",
       "                }, \n",
       "                {\n",
       "                    \"name\": \"\\u65b0\\u534e\\u533a\", \n",
       "                    \"value\": 109.47\n",
       "                }, \n",
       "                {\n",
       "                    \"name\": \"\\u6cca\\u5934\\u5e02\", \n",
       "                    \"value\": 1006.5\n",
       "                }, \n",
       "                {\n",
       "                    \"name\": \"\\u4efb\\u4e18\\u5e02\", \n",
       "                    \"value\": 1023.0\n",
       "                }, \n",
       "                {\n",
       "                    \"name\": \"\\u9ec4\\u9a85\\u5e02\", \n",
       "                    \"value\": 1544.7\n",
       "                }, \n",
       "                {\n",
       "                    \"name\": \"\\u6cb3\\u95f4\\u5e02\", \n",
       "                    \"value\": 1333.0\n",
       "                }, \n",
       "                {\n",
       "                    \"name\": \"\\u6ca7\\u53bf\", \n",
       "                    \"value\": 1104.0\n",
       "                }, \n",
       "                {\n",
       "                    \"name\": \"\\u9752\\u53bf\", \n",
       "                    \"value\": 968.0\n",
       "                }, \n",
       "                {\n",
       "                    \"name\": \"\\u4e1c\\u5149\\u53bf\", \n",
       "                    \"value\": 730.0\n",
       "                }, \n",
       "                {\n",
       "                    \"name\": \"\\u6d77\\u5174\\u53bf\", \n",
       "                    \"value\": 915.1\n",
       "                }, \n",
       "                {\n",
       "                    \"name\": \"\\u76d0\\u5c71\\u53bf\", \n",
       "                    \"value\": 796.0\n",
       "                }, \n",
       "                {\n",
       "                    \"name\": \"\\u8083\\u5b81\\u53bf\", \n",
       "                    \"value\": 525.0\n",
       "                }, \n",
       "                {\n",
       "                    \"name\": \"\\u5357\\u76ae\\u53bf\", \n",
       "                    \"value\": 794.0\n",
       "                }, \n",
       "                {\n",
       "                    \"name\": \"\\u5434\\u6865\\u53bf\", \n",
       "                    \"value\": 600.0\n",
       "                }, \n",
       "                {\n",
       "                    \"name\": \"\\u732e\\u53bf\", \n",
       "                    \"value\": 1191.0\n",
       "                }, \n",
       "                {\n",
       "                    \"name\": \"\\u5b5f\\u6751\\u56de\\u65cf\\u81ea\\u6cbb\\u53bf\", \n",
       "                    \"value\": 387.0\n",
       "                }\n",
       "            ], \n",
       "            \"symbol\": \"circle\", \n",
       "            \"type\": \"map\", \n",
       "            \"label\": {\n",
       "                \"emphasis\": {\n",
       "                    \"position\": null, \n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"#fff\", \n",
       "                        \"fontSize\": 12\n",
       "                    }, \n",
       "                    \"show\": true\n",
       "                }, \n",
       "                \"normal\": {\n",
       "                    \"position\": \"top\", \n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"#000\", \n",
       "                        \"fontSize\": 12\n",
       "                    }, \n",
       "                    \"formatter\": null, \n",
       "                    \"show\": true\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ], \n",
       "    \"toolbox\": {\n",
       "        \"feature\": {\n",
       "            \"restore\": {\n",
       "                \"show\": true\n",
       "            }, \n",
       "            \"dataView\": {\n",
       "                \"show\": true\n",
       "            }, \n",
       "            \"saveAsImage\": {\n",
       "                \"title\": \"\\u4e0b\\u8f7d\\u56fe\\u7247\", \n",
       "                \"show\": true\n",
       "            }\n",
       "        }, \n",
       "        \"top\": \"center\", \n",
       "        \"left\": \"95%\", \n",
       "        \"orient\": \"vertical\", \n",
       "        \"show\": true\n",
       "    }, \n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"textStyle\": {\n",
       "                \"color\": \"#333\", \n",
       "                \"fontSize\": 12\n",
       "            }, \n",
       "            \"show\": true, \n",
       "            \"top\": \"top\", \n",
       "            \"data\": [\n",
       "                \"\"\n",
       "            ], \n",
       "            \"orient\": \"horizontal\", \n",
       "            \"selectedMode\": \"multiple\", \n",
       "            \"left\": \"center\"\n",
       "        }\n",
       "    ], \n",
       "    \"tooltip\": {\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        }, \n",
       "        \"trigger\": \"item\", \n",
       "        \"formatter\": null, \n",
       "        \"triggerOn\": \"mousemove|click\", \n",
       "        \"textStyle\": {\n",
       "            \"color\": \"#fff\", \n",
       "            \"fontSize\": 14\n",
       "        }\n",
       "    }, \n",
       "    \"visualMap\": {\n",
       "        \"text\": [\n",
       "            \"high\", \n",
       "            \"low\"\n",
       "        ], \n",
       "        \"splitNumber\": 5, \n",
       "        \"calculable\": true, \n",
       "        \"orient\": \"vertical\", \n",
       "        \"textStyle\": {\n",
       "            \"color\": \"#000\"\n",
       "        }, \n",
       "        \"min\": 109.47, \n",
       "        \"top\": \"bottom\", \n",
       "        \"showLabel\": true, \n",
       "        \"max\": 1544.7, \n",
       "        \"inRange\": {\n",
       "            \"color\": [\n",
       "                \"#50a3ba\", \n",
       "                \"#eac763\", \n",
       "                \"#d94e5d\"\n",
       "            ]\n",
       "        }, \n",
       "        \"type\": \"continuous\", \n",
       "        \"dimension\": null, \n",
       "        \"left\": \"left\"\n",
       "    }\n",
       "};\n",
       "myChart.setOption(option);\n",
       "\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.charts.map.Map at 0x111d47550>"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from __future__ import unicode_literals\n",
    "from pyecharts import Map\n",
    "#https://baike.baidu.com/item/沧州\n",
    "\n",
    "data=\"\"\"运河区\n",
    "109.92\n",
    "061000\n",
    "新华区\n",
    "109.47\n",
    "061000\n",
    "泊头市\n",
    "1006.5\n",
    "062150\n",
    "任丘市\n",
    "1023\n",
    "062552\n",
    "黄骅市\n",
    "1544.7\n",
    "061100\n",
    "河间市\n",
    "1333\n",
    "062450\n",
    "沧县\n",
    "1104\n",
    "061000\n",
    "青县\n",
    "968\n",
    "062650\n",
    "东光县\n",
    "730\n",
    "061600\n",
    "海兴县\n",
    "915.1\n",
    "061200\n",
    "盐山县\n",
    "796\n",
    "061300\n",
    "肃宁县\n",
    "525\n",
    "130926\n",
    "南皮县\n",
    "794\n",
    "061500\n",
    "吴桥县\n",
    "600\n",
    "061800\n",
    "献县\n",
    "1191\n",
    "062250\n",
    "孟村回族自治县\n",
    "387\n",
    "061400\"\"\"\n",
    "\n",
    "data = data.split('\\n')\n",
    "districts = data[::3]\n",
    "areas = [float(area) for area in data[1::3]]\n",
    "\n",
    "map = Map(\"沧州市图例－各区面积\", width=1200, height=600)\n",
    "map.add(\"\", districts, areas, maptype='沧州', is_visualmap=True, visual_range=[min(areas), max(areas)],\n",
    "        visual_text_color='#000', is_map_symbol_show=False, is_label_show=True)\n",
    "map"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
